#include "threadpool.hpp"
#include <memory>
class MyTask
    : public Task
{
public:
    void process() override
    {
        ::srand(::clock());          // 种随机种子
        int number = ::rand() % 100; // 产生随机数
        cout << "MyTask number = " << number << endl;
    }
};
void test()
{
    unique_ptr<Task> ptask(new MyTask());
    threadpool pool(4, 10);
    pool.start();
    int cnt = 20;
    while (cnt--)
    {
        pool.addTask(ptask.get());
        cout << "cnt = " << cnt << endl;
    }
    pool.stop();
}

int main(int argc, char *argv[])
{
    test();
    return 0;
}